package cc.comac.mom.controller;

import java.util.Map;

import cc.comac.mom.api.lifelimit.LifeLimitPartBaseService;
import cc.comac.mom.bean.lifelimit.LiftLimitBaseParamBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.util.soaputil.SoapCallUtil;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value= "/test")
public class TestController {

	@Autowired
	private LifeLimitPartBaseService lifeLimitPartBaseService;

	@ApiOperation("查询qar信息")
	@RequestMapping("/test1")
	public String test1(@RequestBody String json) {
		try {
				Map<String, Object> invoke = SoapCallUtil.invoke("http://10.13.11.219/c919/web_service/services/IQualityService?wsdl", "sendQualityOrder", json);
			return invoke.toString();
		} catch (Exception e) {
			e.printStackTrace();
			return "报错";
		}
		
	}
	@ApiOperation("当用户在验证平台选择好指定的QAR后，将验证信息指派到QAR")
	@RequestMapping("/test2")
	public String test2(@RequestBody String json) {
		try {
			Map<String, Object> invoke = SoapCallUtil.invoke("http://10.13.11.219/qmis/services/QMISSFSyncService?wsdl", "sendCorrectiveActionResult", json);
			return invoke.toString();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			return "报错";
		}
		
	}
	
	@ApiOperation("将还未生成的QAR验证计划推送至QAR")
	@RequestMapping("/test3")
	public String test3(String json) {
		try {
			Map<String, Object> invoke = SoapCallUtil.invoke("http://localhost:9098/services/QarVerifyPlan?wsdl", "sendCorrectiveActionPlanToQar", json);
				return invoke.toString();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			return "报错";
		}
	}
	
	
	@ApiOperation("将已推送至AO/FO/QAR的验证删除")
	@RequestMapping("/test4")
	public String test4(String json) {
		try {
			Map<String, Object> invoke = SoapCallUtil.invoke("http://localhost:9098/services/QarVerifyPlan?wsdl", "cancelCorrectiveAction", json);
			return invoke.toString();
		} catch (Exception e) {
			return "报错";
		}
		
	}

	@RequestMapping("/test5")
	public String test5() {
		LiftLimitBaseParamBean bean=new LiftLimitBaseParamBean();
		bean.setPartNo("123");
		return lifeLimitPartBaseService.getLiftLimitBaseInfo(bean).toString();
	}
}
